<script src="<?= base_url(); ?>third_party/ckeditor/ckeditor.js"></script>
<div class="grid_7">
    <div class="box">
        <h2>
            <a href="#" id="toggle-tables">EMAIL TEMPLATE MANAGEMENT</a>
        </h2>
        <div class="block" >
            <form name="cat" method="POST" action="<?= base_url(); ?>admin/email_template/get_tempalate">
                <fieldset>
                    <legend>Select Template:</legend>
                    <?php
                    if ($this->session->flashdata('message')) {
                        $msg = $this->session->flashdata('message');
                        echo '<font color="red">' . $msg . '</font>';
                    }
                    ?>
                    <div class="field">
                        <label> Template Name</label>
                        <select name="email_tempalte">
                            <option value="">Select Template --></option>
                            <?php foreach ($emailtemp as $emailtemp): ?>
                                <option value="<?= $emailtemp->id; ?>"><?= $emailtemp->title; ?></option>
                            <?php endforeach; ?>
                        </select>
                        <input name="get_value" type="submit"  value="Get Email Template" />
                    </div>

                </fieldset>
            </form>
        </div>
    </div> <!-- END OF BOX -->
</div>
<?php if (isset($row['info']->id)) { ?>

    <div class="grid_7">
        <div class="box">
            <h2>
                <a href="#" id="toggle-tables">EMAIL TEMPLATE MANAGEMENT : <?= $row['info']->title; ?></a>
            </h2>
            <div class="block" >
                <form name="admin-form" action="<?= base_url(); ?>admin/email_template/update_template" method="post">
                    <fieldset>
                        <legend>UPDATE : <?= strtoupper($row['info']->title); ?> </legend>
                        <?php
                        if ($this->session->flashdata('message')) {
                            $msg = $this->session->flashdata('message');
                            echo '<font color="red">' . $msg . '</font>';
                        }
                        ?>
                        <div class="field" style="float:left; width: 99%">
                            <textarea id="email_temp" name="temp_detail"><?= $row['info']->description; ?></textarea>
                            <script type="text/javascript">
                                //<![CDATA[
                                CKEDITOR.replace( 'temp_detail',
                                {
                                    skin : 'v2',
                                    enterMode : CKEDITOR.ENTER_DIV,
                                    toolbar :
                                        [
                                        [ 'Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink' ],
                                        [ 'UIColor' ]
                                    ]
                                });
                                //]]>
                            </script>
                        </div>
                        <input type="hidden" name="temp_id" value="<?= $row['info']->id; ?>"/>
                        <input type="submit" value="Update <?= ucfirst($row['info']->title); ?>" name="update_template" />
                    </fieldset>
                </form>
            </div>
        </div> <!-- END OF BOX -->
    </div>

<?php } ?>





















